//
// Created by fengg on 2020/3/28.
//

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _CHAR(x)    *(char *)(x)
#define _CHAR_P(x)   (char *)(x)
#define _INT(x)     *(int  *)(x)
#define _ADDR(x)     x->stack+x->item_size*x->top

typedef struct {
    void *stack;
    int top;
    size_t item_size;
    int max_size;
} Stack ;

int init(Stack *s,size_t item_size,size_t num){
    s->top = -1;
    s->stack =  malloc(item_size*num);
    s->item_size = item_size;
    s->max_size = num;
    return 0;
}

int isEmpty(Stack *s){
    return s->top < 0;
}

int isFill(Stack *s){
    return s->top >= s->max_size-1;
}

int push(Stack *s,const void *v,size_t t){
    if(!isFill(s)){
        ++s->top;
        memcpy(_ADDR(s),v,t);
        return 1;
    }
    return 0;
}

void* pop(Stack *s){
    if(!isEmpty(s)){
        void *p = _ADDR(s);
        --s->top;
        return p;
    }

    return NULL;
}

void* peak(Stack *s){
    if(!isEmpty(s)){

        return _ADDR(s);
    }
    return NULL;
}

int main(){
    Stack mark = {};
    char *raw_str = NULL;
    int i,count=0;
    size_t read=0;
    char mark_sign = 0x1;
    init(&mark,1,50);
    getdelim(&raw_str,&read,'@',stdin);
    for (i = 0;raw_str[i] != 0; ++i) {
        if(raw_str[i]=='(')
            push(&mark,&mark_sign,1),++count;
        else if (raw_str[i] == ')')
            pop(&mark);

    }
    if(isEmpty(&mark))
        printf("%d",count);
    else{
        printf("no");
    }

    return 0;
}